import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Login from '../views/login.vue'
import Layout from '../views/layout.vue'
import Personal from '../views/personal.vue'
import Article from '../views/article.vue'
import AddArticle from '../views/addArticle.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'layout',
    component: Layout,
    redirect: '/personal',
    children:[
      {
        path: 'personal',
        name: 'personal',
        component: Personal
      },
      {
        path: 'article',
        name: 'article',
        component: Article
      },
      {
        path: 'addArticle',
        name: 'addArticle',
        component: AddArticle
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
